package com.project.im.web.controller;

import com.project.im.app.dto.AppClientApplyDTO;
import com.project.im.app.vo.ResponseVO;
import com.project.im.common.annotation.Log;
import com.project.im.web.service.AppClientWebService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "应用管理")
@RestController
@RequestMapping("/web/v1/appClient")
@RequiredArgsConstructor
public class AppClientWebController {

    private final AppClientWebService appClientWebService;

    @Log("应用管理-应用申请")
    @Operation(summary = "应用申请")
    @PreAuthorize("hasRole('ROLE_USER')")
    @PostMapping("/apply")
    public ResponseVO<?> apply(@RequestBody AppClientApplyDTO applyDTO) {
        appClientWebService.apply(applyDTO);
        return ResponseVO.success();
    }

}
